﻿using BootyBay.StoreAppMgmtCore.Models;
using BootyBay.StoreAppMgmtCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace BootyBay.StoreAppMgmtCore
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "AgentSvc" in both code and config file together.
    public class AgentSvc : IAgentSvc
    {
        private StoreAppMgmtTaskRepository TaskRepo
        {
            get { return StoreAppMgmtTaskRepository.Instance(); }
        }
        public List<StoreAppMgmtTask> GetAppMgmtTasksInQueueForUser(string userName)
        {
            var taskList = TaskRepo.GetAllAppMgmtTasks(userName, Models.AppOperationStatus.RequestSubmitted);

            return taskList;
        }
 

        public StoreAppMgmtTask GetTaskStatus(Guid taskID)
        {
            var task = TaskRepo.GetTaskStatus(taskID);
            return task;
        }

        public AppLocalStatus GetAppLocalStatus(StoreAppMgmtTask mgmtTask)
        {
            //throw new NotImplementedException();
            return TaskRepo.GetAppLocalStatus(mgmtTask);
        }


        public Guid SubmitClientAppOperationRequest(StoreAppMgmtTask mgmtTask)
        {
            return TaskRepo.SubmitAppMgmtTask(mgmtTask);
        }
    }
}
